@echo off
echo 正在安装ILMerge工具...

REM 安装ILMerge工具
nuget install ilmerge -Version 3.0.41

echo.
echo 正在构建项目...
REM 构建项目
msbuild WebServiceTool.sln /p:Configuration=Release

echo.
echo 正在合并程序集...

REM 合并所有DLL到单个EXE文件中
ilmerge.3.0.41\tools\net452\ILMerge.exe ^
  /target:winexe ^
  /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2" ^
  /out:WebServiceToolSingle.exe ^
  bin\Release\WebServiceTool.exe ^
  bin\Release\Microsoft.Extensions.DependencyInjection.Abstractions.dll ^
  bin\Release\Microsoft.Extensions.DependencyInjection.dll ^
  bin\Release\Microsoft.Extensions.Http.dll ^
  bin\Release\Microsoft.Extensions.Logging.Abstractions.dll ^
  bin\Release\Microsoft.Extensions.Logging.dll ^
  bin\Release\Microsoft.Extensions.Options.dll ^
  bin\Release\Microsoft.Extensions.Primitives.dll

echo.
echo 合并完成！生成的单文件为 WebServiceToolSingle.exe
echo.
pause